package com.zmn.oms.zmn.business.interfaces.work.masterwork;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.dto.serviceitem.AddOrderServiceItemDTO;
import com.zmn.oms.model.dto.warranty.MasterWorkWarrantyDTO;
import com.zmn.oms.model.dto.work.masterwork.*;
import com.zmn.oms.model.dto.work.modify.OrderCompleteReviewDTO;
import com.zmn.oms.model.dto.work.modify.OrderWarrantyDTO;
import com.zmn.oms.model.dto.work.modify.amount.ZsDiscountDTO;
import com.zmn.oms.model.dto.work.modify.must.ZsPartDTO;
import com.zmn.oms.model.entity.work.OrderWork;

import java.util.Date;

/**
 * 类描述：工程师工单业务接口
 * @author heciqi
 * @date 2018/11/02 21:02
 */
public interface ZsMasterWorkBService{

	/**
	 * 工程师接单
	 * @param masterTakeDTO
	 */
	void updateMasterTake(MasterTakeDTO masterTakeDTO) throws OmsBaseException;

	/**
	 *  工程师出发
	 * @param masterLevaeDTO
	 * @return
	 */
	WorkDetailDTO updateMasterLeave(MasterLeaveDTO masterLevaeDTO) throws OmsBaseException;

	/**
	 * 工程师上门
	 * @param masterVisitDTO
	 */
	MasterVisitResponseDTO updateMasterVisit(MasterVisitDTO masterVisitDTO) throws OmsBaseException;

	/**
	 * 改价格
	 * @param changePriceDTO
	 */
	void updatePrice(ChangePriceDTO changePriceDTO) throws OmsBaseException;

	/**
	 * 标记为使用配件
	 * @param usePartDTO
	 */
	void updateUsePart(UsePartDTO usePartDTO) throws OmsBaseException;

	/**
	 * 优惠
	 * @param discountDTO
	 */
	void saveDiscount(ZsDiscountDTO discountDTO) throws OmsBaseException;

	/**
	 * 修改纸质保单号
	 * @param manualCodeDTO
	 */
	void updateManualCode(ManualCodeDTO manualCodeDTO) throws OmsBaseException;

	/**
	 * 修改工程师备注
	 * @param masterRemarkDTO
	 */
	boolean updateMasterRemark(MasterRemarkDTO masterRemarkDTO) throws OmsBaseException;

	/**
	 * 工程师用配件
	 * @param zsPartDTO
	 */
	ResponseDTO updatePart(ZsPartDTO zsPartDTO) throws OmsBaseException;

	/**
	 * 工程师取消配件
	 * @param zsPartDTO
	 */
	ResponseDTO cancelPart(ZsPartDTO zsPartDTO) throws OmsBaseException;

	/**
	 * 保修项
	 * @param orderWarrantyDTO
	 */
	void updateWarranty(OrderWarrantyDTO orderWarrantyDTO) throws OmsBaseException;

	/**
	 * 服务项
	 * @param addOrderServiceItemDTO
	 */
	void updateServiceItem(AddOrderServiceItemDTO addOrderServiceItemDTO) throws OmsBaseException;

	/**
	 * 贴花照片
	 * @param orderImageDTO
	 */
	void updateAppliqueImage(OrderImageDTO orderImageDTO) throws OmsBaseException;

	/**
	 * 工单照片
	 * @param orderImageDTO
	 */
	void updateOrderImage(OrderImageDTO orderImageDTO) throws OmsBaseException;

	/**
	 * 工单工程师照片
	 * @param orderImageDTO
	 */
	void updateMasterImage(OrderImageDTO orderImageDTO) throws OmsBaseException;

	/**
	 * 检查工程师是否有未完成进行中工单
	 * @param masterId
	 */
	boolean checkWorkStatus(Integer masterId, Date startTime, Date endTime) throws OmsBaseException;

	/**
	 * 检查工程师是否有未完成进行中工单(区分返回)
	 * @param masterId
	 */
	MasterWorkStatusDTO getMasterWorkStatus(Integer masterId, Date startTime, Date endTime) throws OmsBaseException;

	/**
	 * 进行中工单
	 * @param masterId
	 */
	WorkListDTO getWorkingList(Integer masterId) throws OmsBaseException;

	/**
	 * 完成工单
	 * @param masterId
	 */
	WorkListDTO getCompleteWorkList(Integer plat, Integer masterId, Date startDate, Date endDate, Integer startIndex, Integer pageSize) throws OmsBaseException;

	/**
	 * 工单详情
	 * @param plat
	 * @param orderId
	 * @param workId
	 * @param masterId
	 * @param agent
	 * */
	WorkDetailDTO getWorkDetail(Integer plat, Long orderId, Long workId, Integer masterId, Integer agent) throws OmsBaseException;
	WorkDetailDTO getWorkDetailSrcMaster(Integer plat, Long orderId, Long workId, Integer masterId, Integer agent) throws OmsBaseException;

	/**
	 * 简版工单详情
	 * @param plat
	 * @param orderId
	 * @param workId
	 */
	WorkDetailDTO getWorkSimpleDetail(Integer plat, Long orderId, Long workId) throws OmsBaseException;

	/**
	 * 历史工单详情
	 * @param masterId
	 */
	WorkDetailDTO getHisWorkDetail(Integer plat, Long orderId, Long workId, Integer masterId, Integer agent) throws OmsBaseException;

	/**
	 * 检查工单优惠状态
	 */
	void checkDiscountStatus(Long orderId, Long workId, Integer masterId) throws OmsBaseException;

	/**
	 * 是否需要完成码
	 * @param workId
	 */
	Boolean needCompleteCode(Long orderId, Long workId);

	/**
	 * 服务完成
	 * @param completeDIO
	 * @throws OmsBaseException
	 */
	void serviceComplete(ServiceCompleteDIO completeDIO) throws OmsBaseException;

	/**
	 * 服务完成审核
	 * @param orderCompleteReviewDTO
	 * @throws OmsBaseException
	 */
	void saveCompleteReview(OrderCompleteReviewDTO orderCompleteReviewDTO) throws OmsBaseException;

	/**
	 * 自动服务完成审核成功
	 * @param orderCompleteReviewDTO
	 */
	void autoReviewComplete(OrderCompleteReviewDTO orderCompleteReviewDTO);

	/**
	 * 工单完成
	 * @param completeDTO
	 */
	void completeOrder(CompleteDTO completeDTO) throws OmsBaseException;

	/**
	 * 判断是否质保金支付金额等于订单金额
	 * @param completeDTO
	 * @param orderWork
	 * @throws OmsBaseException
	 */
	void checkWarrantyPay(CompleteDTO completeDTO, OrderWork orderWork, Boolean warranty) throws OmsBaseException;

	/**
	 * 添加保留配件任务
	 * @param orderWork
	 * @param retainPartStartTime
	 */
	void addRetainPartJob(OrderWork orderWork, Date retainPartStartTime);

	/**
	 * 记录工程师联系用户
	 * @param contactUserDTO
	 */
	void saveContactUser(ContactUserDTO contactUserDTO) throws OmsBaseException;

	/**
	 * 记录工程师联系用户时间
	 * @param contactUserDTO
	 */
	void saveContactUserTime(ContactUserDTO contactUserDTO) throws OmsBaseException;

	/**
	 * 查询会员单审核
	 */
	MemberReviewDTO getMemberReview(Integer plat, Long orderId, Long workId, Integer masterId) throws OmsBaseException;

	/**
	 * 查询会员单审核信息(重写)
	 */
	MemberReviewDTO getMemberVerifyInfo(Integer plat, Long orderId, Long workId, Integer masterId) throws OmsBaseException;

	/**
	 * (师傅)审核会员单(重写)
	 */
	void masterVerifyMemberOrder(MasterVerifyMemberOrderDTO masterVerifyMemberOrderDTO) throws OmsBaseException;

	/**
	 * 获取工单保修卡
	 * @param orderId
	 * @param workId
	 * @return
	 */
	MasterWorkWarrantyDTO getWorkWarranty(Long orderId, Long workId);

	/**
	 * 获取上门二维码
	 * @param orderId
	 * @param workId
	 * @return
	 */
	MasterWorkVisitQrCodeDTO getWorkVisitQrCode(Long orderId, Long workId) throws OmsBaseException;

	/**
	 * 校验是否可以
	 * @param modifyDutyTimeDTO
	 */
	com.zmn.oms.common.dto.ResultDTO<Integer> checkDutyTimeCount(ModifyDutyTimeDTO modifyDutyTimeDTO) throws OmsBaseException ;


	/**
	 * 修改预约时间(不操作库存)
	 * @param modifyDutyTimeDTO
	 */
	void updateDutyTimeWithNoStock(ModifyDutyTimeDTO modifyDutyTimeDTO) throws OmsBaseException;

	/**
	 * 修改预约时间
	 * @param modifyDutyTimeDTO
	 */
	void updateDutyTime(ModifyDutyTimeDTO modifyDutyTimeDTO) throws OmsBaseException;

	/**
	 * 改派工程师
	 * @param changeMasterDTO
	 */
	void updateMaster(ChangeMasterDTO changeMasterDTO) throws OmsBaseException;

	/**
	 * 获取工单可派单工程师列表
	 * @param orderId
	 * @param workId
	 */
	WorkDistributeMasterDTO getWorkDistributeMasterList(Long orderId, Long workId) throws OmsBaseException;

	/**
	 * 验证完成核销码
	 * @param orderId  订单id
	 * @param workId   工单id
	 * @param completeCode  完成核销码
	 * @throws OmsBaseException
	 */
	void verifyCompleteCode(Long orderId, Long workId,String completeCode) throws OmsBaseException;

	/**
	 * 获取报价信息和优惠信息
	 *
	 * @param orderWork
	 * @return
	 * @throws OmsBaseException
	 */
	MasterQuotationDiscountDTO getQuotationAndDiscountInfo(OrderWork orderWork) throws OmsBaseException;

	/**
	 * 工单报价显示相关
	 *
	 * @param orderWork
	 */
	WorkQuotationShowDTO getQuotationShow(OrderWork orderWork);

	/**
	 * 师傅操作检查信息
	 *
	 * @param orderId
	 * @param workId
	 * @return
	 */
	MasterWorkOperateCheckInfoDTO getMasterWorkOperateCheckInfo(Long orderId, Long workId);

	/**
	 * 获取app操作对应的返回信息
	 *
	 * @param orderId
	 * @param operateId
	 * @return
	 */
	WorkResultDTO getOperateInfo(Long orderId, Integer operateId);

	/**
	 * 师傅审核订单取消
	 *
	 * @param cancelConfirmDTO
	 * @throws OmsBaseException
	 */
	void reviewOrderCancel(CancelConfirmDTO cancelConfirmDTO) throws OmsBaseException;
}
